VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmReporteListadoDeSaldos 
   BackColor       =   &H80000013&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Listado de Saldos"
   ClientHeight    =   4125
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   7500
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4125
   ScaleWidth      =   7500
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame1 
      BackColor       =   &H80000013&
      Height          =   2775
      Left            =   120
      TabIndex        =   7
      Top             =   120
      Width           =   6615
      Begin VB.CommandButton cmdVer 
         Caption         =   "&Ver Reporte"
         Height          =   855
         Left            =   4920
         Picture         =   "frmReporteListadoDeSaldos.frx":0000
         Style           =   1  'Graphical
         TabIndex        =   5
         Top             =   600
         Width           =   1335
      End
      Begin VB.CheckBox chkCiudad 
         BackColor       =   &H80000013&
         Caption         =   "Todas las Ciudades"
         Height          =   255
         Left            =   2760
         TabIndex        =   1
         Top             =   480
         Width           =   1815
      End
      Begin VB.ComboBox cmbCiudad 
         Height          =   315
         Left            =   240
         Style           =   2  'Dropdown List
         TabIndex        =   0
         Top             =   480
         Width           =   2295
      End
      Begin CtaCte.txtImporte txtHasta 
         Height          =   375
         Left            =   2640
         TabIndex        =   3
         Top             =   1440
         Width           =   1095
         _extentx        =   1931
         _extenty        =   661
      End
      Begin CtaCte.txtImporte txtDesde 
         Height          =   375
         Left            =   840
         TabIndex        =   2
         Top             =   1440
         Width           =   1095
         _extentx        =   1931
         _extenty        =   661
      End
      Begin MSComCtl2.DTPicker dtFecha 
         Height          =   375
         Left            =   240
         TabIndex        =   4
         Top             =   2160
         Width           =   1335
         _ExtentX        =   2355
         _ExtentY        =   661
         _Version        =   393216
         Format          =   66453505
         CurrentDate     =   39671
      End
      Begin VB.Label Fe 
         BackColor       =   &H80000013&
         Caption         =   "Fecha Hasta"
         Height          =   255
         Left            =   240
         TabIndex        =   12
         Top             =   1920
         Width           =   2055
      End
      Begin VB.Label Label1 
         BackColor       =   &H80000013&
         Caption         =   "Saldo"
         Height          =   255
         Left            =   240
         TabIndex        =   11
         Top             =   1080
         Width           =   2055
      End
      Begin VB.Label Label2 
         BackColor       =   &H80000013&
         Caption         =   "Ciudad"
         Height          =   255
         Left            =   240
         TabIndex        =   10
         Top             =   240
         Width           =   2295
      End
      Begin VB.Label Label3 
         BackColor       =   &H80000013&
         Caption         =   "Desde"
         Height          =   255
         Left            =   240
         TabIndex        =   9
         Top             =   1440
         Width           =   615
      End
      Begin VB.Label Label4 
         BackColor       =   &H80000013&
         Caption         =   "Hasta"
         Height          =   255
         Left            =   2040
         TabIndex        =   8
         Top             =   1440
         Width           =   975
      End
   End
   Begin VB.CommandButton cmdSalir 
      Caption         =   "Ce&rrar"
      Height          =   855
      Left            =   240
      Picture         =   "frmReporteListadoDeSaldos.frx":058A
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   3120
      Width           =   1455
   End
End
Attribute VB_Name = "frmReporteListadoDeSaldos"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim dt As typecombo
Dim where, cons As String


Private Sub cmdSalir_Click()
Unload Me
End Sub

Private Sub cmdVer_Click()

cons = " SELECT cli.Nombreorazonsocial, ciu.nombre, "
cons = cons & " (select isnull(sum(isnull(debe,0))-sum(isnull(haber,0)),0) "
cons = cons & "     from v_transaccion v "
cons = cons & "     where v.id_cliente = cli.id_cliente "
cons = cons & "     and v.fecha <= '" & dtFecha.Value & "'"
cons = cons & "     and contado = 0)  as saldo, cli.id_ciudad "
cons = cons & " into saldotemporal "
cons = cons & " FROM dbo.Cliente cli, ciudad ciu "
cons = cons & " where cli.id_ciudad = ciu.id_ciudad "

cn.Execute cons

where = " saldo >= " & Str(txtDesde.text) & " AND saldo <= " & Str(txtHasta.text)
If chkCiudad.Value = 0 Then where = where & " AND id_ciudad = " & cmbCiudad.ItemData(cmbCiudad.ListIndex)
ConsultaSql "select * from saldotemporal where " & where & " AND saldo <> 0 order by nombreorazonsocial"
Set rptListadoSaldosChico.DataSource = rs
'rptListadoSaldosChico.Orientation = rptOrientPortrait
rptListadoSaldosChico.Sections.item("Encabezado").Controls("rptNombre").Caption = parametro(1)
rptListadoSaldosChico.Sections.item("Encabezado").Controls("rptDe").Caption = "De: " & parametro(2)
rptListadoSaldosChico.Sections.item("Encabezado").Controls("Etiqueta11").Caption = "al " & dtFecha.Value
rptListadoSaldosChico.Show
cn.Execute "DROP TABLE saldotemporal"


End Sub

Private Sub chkCiudad_Click()
If chkCiudad.Value = 1 Then
    cmbCiudad.Enabled = False
Else
    cmbCiudad.Enabled = True
End If
End Sub

Private Sub Form_Load()
dtFecha.Value = Date
txtDesde.settext "0"
txtHasta.settext "99999999"
dt.item = "id_ciudad"
dt.text = "nombre"
ConsultaSql "select * from ciudad order by id_ciudad"
cargarcombo cmbCiudad, rs, dt
validarcombo cmbCiudad, 1
chkCiudad.Value = 1
End Sub


